<%@ page import="com.xszx.entity.TUser" %><%--
  Created by IntelliJ IDEA.
  User: 32312
  Date: 2024/1/9
  Time: 10:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri='http://java.sun.com/jsp/jstl/core' %>
<%
    TUser user = (TUser)request.getSession().getAttribute("user");
%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title></title>

    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link rel="stylesheet" href="/resource/materialize/css/materialize.min.css" media="screen,projection" />
    <!-- Bootstrap Styles-->
    <link href="/resource/css/bootstrap.css" rel="stylesheet" />
    <!-- FontAwesome Styles-->
    <link href="/resource/css/font-awesome.css" rel="stylesheet" />
    <!-- Morris Chart Styles-->
    <link href="/resource/js/morris/morris-0.4.3.min.css" rel="stylesheet" />
    <!-- Custom Styles-->
    <link href="/resource/css/custom-styles.css" rel="stylesheet" />
    <!-- Google Fonts-->
    <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
    <link rel="stylesheet" href="/resource/js/Lightweight-Chart/cssCharts.css">
</head>
<body>
<div id="wrapper">
    <nav class="navbar navbar-default top-navbar" role="navigation">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand waves-effect waves-dark" href="/jsp/index.jsp"><i class="large material-icons">insert_chart</i> <strong>TRACK</strong></a>

            <div id="sideNav" href=""><i class="material-icons dp48">toc</i></div>
        </div>

        <ul class="nav navbar-top-links navbar-right">
            <li><a class="dropdown-button waves-effect waves-dark" href="#!" data-activates="dropdown1"><i class="fa fa-user fa-fw"></i> <b>${user.username}</b></a></li>
        </ul>
    </nav>
    <!-- Dropdown Structure -->
    <ul id="dropdown1" class="dropdown-content">
        <li><a href="/jsp/form.jsp"><i class="fa fa-user fa-fw"></i> 个人中心</a>
        </li>
        <li><a href="/jsp/personCenter.jsp"><i class="fa fa-bell fa-fw"></i> 个人任务</a>
        </li>
        <li><a href="/jsp/test.jsp" target="_top"><i class="fa fa-sign-out fa-fw"></i> 注销</a>
        </li>
    </ul>
    <ul id="dropdown2" class="dropdown-content w250">
        <li>
            <a href="#">
                <div>
                    <i class="fa fa-comment fa-fw"></i> New Comment
                    <span class="pull-right text-muted small">4 min</span>
                </div>
            </a>
        </li>
        <li class="divider"></li>
        <li>
            <a href="#">
                <div>
                    <i class="fa fa-twitter fa-fw"></i> 3 New Followers
                    <span class="pull-right text-muted small">12 min</span>
                </div>
            </a>
        </li>
        <li class="divider"></li>
        <li>
            <a href="#">
                <div>
                    <i class="fa fa-envelope fa-fw"></i> Message Sent
                    <span class="pull-right text-muted small">4 min</span>
                </div>
            </a>
        </li>
        <li class="divider"></li>
        <li>
            <a href="#">
                <div>
                    <i class="fa fa-tasks fa-fw"></i> New Task
                    <span class="pull-right text-muted small">4 min</span>
                </div>
            </a>
        </li>
        <li class="divider"></li>
        <li>
            <a href="#">
                <div>
                    <i class="fa fa-upload fa-fw"></i> Server Rebooted
                    <span class="pull-right text-muted small">4 min</span>
                </div>
            </a>
        </li>
        <li class="divider"></li>
        <li>
            <a class="text-center" href="#">
                <strong>See All Alerts</strong>
                <i class="fa fa-angle-right"></i>
            </a>
        </li>
    </ul>
    <!--/. NAV TOP  -->
    <!--/. NAV TOP  -->
    <nav class="navbar-default navbar-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav" id="main-menu">

                <li>
                    <a class="active-menu waves-effect waves-dark" href="/jsp/index.jsp"><i class="fa fa-dashboard"></i> 统计</a>
                </li>

                <li>
                    <a href="#" class="waves-effect waves-dark"><i class="fa fa-sitemap"></i>固定资产管理<span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li>
                            <a href="#">资产管理<span class="fa arrow"></span></a>
                            <ul class="nav nav-third-level">
                                <li>
                                    <a href="/jsp/assetTable.jsp">总资产管理</a>
                                </li>
                                <li>
                                    <a href="/jsp/assetFixTable.jsp">维修资产</a>
                                </li>
                                <li>
                                    <a href="/jsp/assetForbiddenTable.jsp">禁用资产</a>
                                </li>
                                <li>
                                    <a href="/jsp/assetFreeTable.jsp">空闲资产</a>
                                </li>
                                <li>
                                    <a href="/jsp/assetScrapTable.jsp">报废资产</a>
                                </li>
                                <li>
                                    <a href="/jsp/assetUsingTable.jsp">使用中资产</a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <a href="/jsp/recordTable.jsp">合同管理</a>
                        </li>
                        <li>
                            <a href="#">系统管理<span class="fa arrow"></span></a>
                            <ul class="nav nav-third-level">
                                <li>
                                    <a href="/jsp/deptTable.jsp">部门管理</a>
                                </li>
                                <li>
                                    <a href="/jsp/user.jsp">用户管理</a>
                                </li>
                                <li>
                                    <a href="/jsp/roleTable.jsp">角色管理</a>
                                </li>
                                <li>
                                    <a href="/jsp/menuTable.jsp">菜单管理</a>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="/jsp/empty.jsp" class="waves-effect waves-dark"><i class="fa fa-fw fa-file"></i> 日志</a>
                </li>
            </ul>

        </div>

    </nav>
    <!-- /. NAV SIDE  -->
    <div id="page-wrapper" >
        <div class="header">
            <h1 class="page-header">
                合同管理
            </h1>
            <ol class="breadcrumb">
                <li><a href="#">Home</a></li>
                <li><a href="#">合同管理</a></li>
                <li class="active">数据</li>
            </ol>

        </div>

        <div id="page-inner">

            <div class="row">
                <div class="col-md-12">
                    <!--    Hover Rows  -->
                    <div class="card">
                        <div class="card-content">
                            <div class="table-responsive">
                                <table class="table table-hover">
                                    <thead>
                                    <tr>
                                        <th>合同ID</th>
                                        <th>合同名称</th>
                                        <th>合同类型</th>
                                        <th>甲方名称</th>
                                        <th>乙方名称</th>
                                        <th>创建时间</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody id="contractList">

                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <!-- End  Hover Rows  -->



                </div>
            </div>

        </div>
        <!-- /. PAGE INNER  -->
    </div>
    <!-- /. PAGE WRAPPER  -->
    <!-- /. WRAPPER  -->
    <!-- JS Scripts-->


    <%--合同详情--%>
    <div class="modal fade details" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
        <div class="modal-dialog modal-lg" role="document">
            <div class="modal-content">
                <div class="sign-content">

                    <div class="modal-header">
                        <h2>合同详情</h2>
                    </div><!--/.modal-header -->

                    <div class="modal-body">
                        <div class="signin-form">
                            <div class=" ">
                                <div class=" ">
                                    <form action="">
                                        <div class="form-group">
                                            <label for="cid">合同ID</label>
                                            <input type="text" class="form-control" readonly name="cid" id="cid" >
                                        </div>
                                        <div class="form-group">
                                            <label for="cname">合同名称</label>
                                            <input type="text" class="form-control" readonly name="cname" id="cname" >
                                        </div>
                                        <div class="form-group">
                                            <label for="ctype">合同类型</label>
                                            <input type="text" class="form-control" readonly name="ctype" id="ctype" >
                                        </div>
                                        <div class="form-group">
                                            <label for="armorName">甲方名称</label>
                                            <input type="text" class="form-control" readonly name="armorName" id="armorName">
                                        </div>
                                        <div class="form-group">
                                            <label for="armorPhone">甲方联系方式</label>
                                            <input type="text" class="form-control" readonly name="armorPhone" id="armorPhone" >
                                        </div>
                                        <div class="form-group">
                                            <label for="deptName">甲方部门</label>
                                            <input type="text" class="form-control" readonly name="deptName" id="deptName" >
                                        </div>
                                        <div class="form-group">
                                        <label for="secondsName">乙方名称</label>
                                        <input type="text" class="form-control" readonly name="secondsName" id="secondsName" >
                                    </div>
                                        <div class="form-group">
                                            <label for="secondsPhone">乙方联系方式</label>
                                            <input type="text" class="form-control" readonly name="secondsPhone" id="secondsPhone" >
                                        </div>
                                        <div class="form-group">
                                            <label for="secondsDept">乙方部门</label>
                                            <input type="text" class="form-control" readonly name="secondsDept" id="secondsDept" >
                                        </div>
                                        <div class="form-group">
                                            <label for="createname">创建部门</label>
                                            <input type="text" class="form-control" readonly name="createname" id="createname" >
                                        </div>
                                        <div class="form-group">
                                            <label for="createdate">创建日期</label>
                                            <input type="text" class="form-control" readonly name="createdate" id="createdate" >
                                        </div>
                                        <div class="form-group">
                                            <label for="cstatus">合同状态</label>
                                            <input type="text" class="form-control" readonly name="cstatus" id="cstatus" >
                                        </div>
                                        <div class="form-group">
                                            <label for="assetsName">资产名称</label>
                                            <input type="text" class="form-control" readonly name="assetsName" id="assetsName" >
                                        </div>
                                        <div class="form-group">
                                            <label for="assetsAserial">规格型号</label>
                                            <input type="text" class="form-control" readonly name="assetsAserial" id="assetsAserial" >
                                        </div>
                                        <div class="form-group">
                                            <label for="assetsAcode">资产编号</label>
                                            <input type="text" class="form-control" readonly name="assetsAcode" id="assetsAcode" >
                                        </div>
                                        <div class="form-group">
                                            <label for="assetsPrice">资产原价</label>
                                            <input type="text" class="form-control" readonly name="assetsPrice" id="assetsPrice">
                                        </div>
                                        <div class="signin-footer">
                                        <a href="/jsp/recordTable.jsp">
                                            <button type="button" class="btn signin_btn" data-toggle="modal" data-target=".signin_modal">
                                                退出
                                            </button>
                                        </a>
                                    </div>
                                    </form><!--/form -->
                                </div><!--/.col -->
                            </div><!--/.row -->

                        </div><!--/.signin-form -->
                    </div>

                </div><!--/.sign-content -->
            </div><!--/.modal-content -->
        </div><!--/.modal-dialog -->
    </div><!--/.modal -->


    <!-- jQuery Js -->
    <script src="/resource/js/jquery-1.10.2.js"></script>

    <!-- Bootstrap Js -->
    <script src="/resource/js/bootstrap.min.js"></script>

    <script src="/resource/materialize/js/materialize.min.js"></script>

    <!-- Metis Menu Js -->
    <script src="/resource/js/jquery.metisMenu.js"></script>
    <!-- Morris Chart Js -->
    <script src="/resource/js/morris/raphael-2.1.0.min.js"></script>
    <script src="/resource/js/morris/morris.js"></script>


    <script src="/resource/js/easypiechart.js"></script>
    <script src="/resource/js/easypiechart-data.js"></script>

    <script src="/resource/js/Lightweight-Chart/jquery.chart.js"></script>
    <!-- DATA TABLE SCRIPTS -->
    <script src="/resource/js/dataTables/jquery.dataTables.js"></script>
    <script src="/resource/js/dataTables/dataTables.bootstrap.js"></script>
    <script>
        $(document).ready(function () {
            $('#dataTables-example').dataTable();
        });



        $(function () {
            $.ajax({
                url: "/selectContract",
                dataType: "json",
                type: "post",
                success: function (data) {
                    console.log(data)
                    for (let i = 0; i < data.length; i++) {
                        // <th>合同ID</th>
                        // <th>合同名称</th>
                        // <th>合同类型</th>
                        // <th>甲方名称</th>
                        // <th>乙方名称</th>
                        // <th>创建时间</th>
                        let createdate = data[i].createdate;
                        let year = new Date(createdate).getFullYear();
                        let month = new Date(createdate).getMonth()+1;
                        let day = new Date(createdate).getDay();
                        let time = year+"-"+month+"-"+day;
                        $("#contractList").
                        append("<tr>" +
                            "<td>"+data[i].cid+"</td>"+
                            "<td>"+data[i].cname+"</td>"+
                            "<td>"+data[i].ctype+"</td>"+
                            "<td>"+data[i].armorName+"</td>"+
                            "<td>"+data[i].secondName+"</td>"+
                            "<td>"+time+"</td>"+
                            "<td>"+"<button class=btn signin_btn da" +
                            "ta-toggle=modal data-target=.details onclick='particulars("+data[i].cid+")'>" +
                            "查看详情" +"</td>")

                    }
                }
            })
        })

        function particulars(cid){
            $.ajax({
                url: "/selectContractByCidAndDept",
                data:{
                    cid:cid
                },
                dataType: "json",
                type: "post",
                success:function (data){
                    let createdate = data.createdate;
                    let year = new Date(createdate).getFullYear();
                    let month = new Date(createdate).getMonth()+1;
                    let day = new Date(createdate).getDay();
                    let time = year+"-"+month+"-"+day;
                    console.log(data);
                    $("#cid").val(data.cid);
                    $("#cname").val(data.cname);
                    $("#ctype").val(data.ctype);
                    $("#armorName").val(data.armorName);
                    $("#armorPhone").val(data.armorPhone);
                    $("#deptName").val(data.armorDept);
                    $("#secondsName").val(data.secondName);
                    $("#secondsPhone").val(data.secondPhone);
                    $("#secondsDept").val(data.secondDept);
                    $("#createname").val(data.createname);
                    $("#createdate").val(time);
                    $("#cstatus").val(data.cstatus);
                    $("#assetsName").val(data.aname);
                    $("#assetsAserial").val(data.aserial);
                    $("#assetsAcode").val(data.acode);
                    $("#assetsPrice").val(data.aprice);
                }
            })
        }
    </script>
    <!-- Custom Js -->
    <script src="/resource/js/custom-scripts.js"></script>


</div>
</body>

</html>

